package cn.hznc.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @Author：Administrator
 * @Date：2023/6/7 15:26
 */
@Getter
@Setter
@Table(name = "t_employee")
@TableName(value = "t_employee")
public class EmployeeEntity{

    /**
     * 主键id
     */
    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 员工名
     */
    @Column(name = "employee_name",type = MySqlTypeConstant.VARCHAR,length = 11)
    @TableField(value = "employee_name")
    private String employeeName;

    @Column(name = "employee_no",type = MySqlTypeConstant.VARCHAR,length = 11)
    @TableField(value = "employee_no")
    private String employeeNo;

    @Column(name = "user_id",type = MySqlTypeConstant.INT ,length = 11)
    @TableField(value = "user_id")
    private Integer userId;

    @Column(name = "company",type = MySqlTypeConstant.VARCHAR,length = 255)
    @TableField(value = "company")
    private String company;

    @Column(name = "department",type = MySqlTypeConstant.VARCHAR,length = 255)
    @TableField(value = "department")
    private String department;

    @TableField(exist = false)
    private List<String> roleNames;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        EmployeeEntity that = (EmployeeEntity) o;

        if (!id.equals(that.id)) return false;
        if (!employeeName.equals(that.employeeName)) return false;
        return employeeNo.equals(that.employeeNo);
    }

    @Override
    public int hashCode() {
        int result = id.hashCode();
        result = 31 * result + employeeName.hashCode();
        result = 31 * result + employeeNo.hashCode();
        return result;
    }
}
